#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>

using namespace std;
struct Human
{
    int id;
    string name;
};
class Student
{
   public:
    int id;
    string name;
    Student::Student()
    {

    }
    Student(int pid, string pName)
    {
        this->id = pid;
        this->name = pName;
    }
    ~Student()
    {

    }
    string show()
    {
        cout<<"my name is "<<name;   
    }
};
ostream& operator<<(ostream & out, struct Human &h)
{
    cout<<h.id<<" "<<h.name<<endl;
    return out;
}

ostream& operator<<(ostream & out, class Student &s)
{
    cout<<s.id<<" "<<s.name<<endl;
    return out;
}
int main()
{
    cout<<string(5,'*')<<"basic data type"<<string(5,'*')<<endl;
    int i1;
    int i2 = 10;
    
    int * pi1 = new int(10);
    cout<<*pi1<<endl;
    delete pi1;

    int a1[10];
    int a2[] = {0,1,2,3,4,5}; 
    
    for(auto it = begin(a1); it!=end(a1); it++)
                *it = rand();
    
    for(auto it = begin(a1); it!=end(a1); it++)
            cout<<*it<<" ";
    
    int * ap1 = new int[10]; 
    ap1[0] = 10;
    *(ap1+1) = 20;


    cout<<"\n"<<string(5,'*')<<"struct data type"<<string(5,'*')<<endl;

    struct Human h1;
    struct Human h2={10,"zs"};
    cout<<h1<<h2;
    
    struct Human *ph1 = new Human;
    ph1->id = 1;
    ph1->name = "zs";

    struct Human ah1[10];
    struct Human ah2[5] ={{1,"zs"},{2,"ls"},{3,"ww"}};
    cout<<ah2[0]<<ah2[4];

    struct Human * aph1 = new Human[10];
    aph1[0].id = 1;
    aph1[0].name = "zs";
    (aph1+1)->id = 2;
    (aph1+1)->name = "ls";

    struct Human * aph2[10];



    cout<<string(5,'*')<<"class "<<string(5,'*')<<endl;
    class Student s1;
    class Student s2(10,"zs"); 
    cout<<s1<<s2;

    class Student *ps1 = new Student();
    class Student *ps2 = new Student(1,"zs");

    class Student as1[10];
    class Student as2[10] = {Student(1,"zs"),Student(2,"ls")}; 

    class Student *ps3 = new Student[10];
    (ps3+1)->id = 1;
    (ps3+1)->name = "zs";


}